<!DOCTYPE html>
<%@page import="java.util.*"%>
<%@page import="java.io.*"%>
<%@page import="java.text.*"%>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>居委会新闻</title>

<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    
</head>
<body>
<%

try{
	Date currentDate = new Date();
	
	if(application.getAttribute("global-counter") == null){
		application.setAttribute("global-counter", 0);
	}
	int total = (Integer)application.getAttribute("global-counter");
	application.setAttribute("global-counter", ++total);
	if (total % 5 == 0){
		File file = new File(System.getProperty("user.dir") + File.separator + "result.txt");
		if (!file.exists()){
			BufferedWriter bw = new BufferedWriter(new FileWriter(file));
			bw.write(new SimpleDateFormat("yyyy/MM/dd").format(new Date()) + " " + "0");
			bw.flush();
			bw.close();
		}
		List<String> lines = new ArrayList<String>();
		BufferedReader br = new BufferedReader(new FileReader(file));
		String line;
		while ((line = br.readLine()) != null){
			lines.add(line);
		}
		if (lines.size() == 0){
			lines.add(new SimpleDateFormat("yyyy/MM/dd").format(new Date()) + " " + "0");
		}
		br.close();
		if (!lines.get(lines.size() - 1).split(" ")[0].equals(new SimpleDateFormat("yyyy/MM/dd").format(new Date()))){
			lines.add(new SimpleDateFormat("yyyy/MM/dd").format(new Date()) + " " + "0");
		}
		BufferedWriter bw = new BufferedWriter(new FileWriter(file));
		for (int i = 0; i < lines.size(); i ++){
			String newLine = lines.get(i);
			
			if (i == lines.size() - 1){
				newLine = newLine.split(" ")[0] + " " + total;
			}
			bw.write(newLine);
			bw.newLine();
		}
		bw.flush();
		bw.close();
	}
}catch(Exception e){}
%>
	<div class="container">
		<br />
	</div>
	<div class="container">
		<div class="panel panel-danger">
			<div class="panel-heading" style="text-align: center; padding-left: 0px; padding-right: 0px;">
				  <h3>免费看高清，360元等你拿</h3>
				  <label>来源：天津广电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= new SimpleDateFormat("yyyy年MM月dd日").format(new Date()) %></label>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<div class="thumbnail" style="margin-bottom: 0px;">
						<img alt="..."
							src="img/detail/360.jpg">
						<h4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;昔阳里社区居委会与广电携手合作，服务社区居民，大礼送不停！即日起至9月14日前，办理广电爱看高清互动套餐的前360名社区居民，除套餐费全额返还以外，更可免费获赠价值360元代金券，可用于社区食堂订餐、超市购物！<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;免费更换高清互动机顶盒，免费观看数十套高清电视节目，回放时移，精彩节目再不错过；<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;超过2万小时影视点播，打开电视看高清大片；<br />
添加昔阳里社区独特定制智慧社区，预约挂号、社区购物、电视缴费、食堂订餐，足不出户享受更好服务！</h4>
					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
	<script src="js/jquery.min.js"></script>
	<!-- Include all compiled plugins (below), or include individual files as needed -->
	<script src="js/bootstrap.min.js"></script>
</body>
</html>